﻿@model ProjectScopeConfigurationModel

@using SDF.Core

@{
    var webHelper = EngineContext.Current.Resolve<IWebHelper>();
    var projects = Model.Projects.Select(project => new SelectListItem
    {
        Text = project.Name,
        Value = webHelper.ModifyQueryString(Url.Action("ChangeProjectScopeConfiguration", new { projectid = project.Id }), "returnurl=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl), null),
        Selected = project.Id.Equals(Model.ProjectId)
    })
        .ToList();
    projects.Insert(0, new SelectListItem
    {
        Text = T("Admin.Configuration.Settings.ProjectScope.AllProjects").Text,
        Value = webHelper.ModifyQueryString(Url.Action("ChangeProjectScopeConfiguration", new { projectid = 0 }), "returnurl=" + HttpUtility.UrlEncode(HttpContext.Current.Request.RawUrl), null),
        Selected = 0.Equals(Model.ProjectId)
    });
}

<div class="form-group">
    <div class="col-md-12 project-scope-configuration">
        <div class="label-wrapper">
            <label class="control-label">
                @T("Admin.Configuration.Settings.ProjectScope")
            </label>
        </div>
        @Html.SDFDropDownList("project-scope-configuration", projects, new {onchange = "setLocation(this.value);", style = "width: auto;min-width: 300px;"})
        @if (Model.ProjectId > 0)
        {
            <div class="checkbox">
                <label>
                    <input type="checkbox" onclick="checkAllOverriddenStoreValue(this)">
                    <b>@T("Admin.Configuration.Settings.ProjectScope.CheckAll")</b> @T("Admin.Configuration.Settings.ProjectScope.CheckAll.Hint")
                </label>
            </div>
        }
    </div>
</div>


